//
//  LCResetPasswordViewController.m
//  lechuang
//
//  Created by Mr_hi on 2023/4/3.
//  Copyright © 2023 Mooyi. All rights reserved.
//

#import "LCResetPasswordViewController.h"
#import "LCLoginService.h"
@interface LCResetPasswordViewController ()

@property (weak, nonatomic) IBOutlet UITextField *pswdTfl;
@property (weak, nonatomic) IBOutlet UITextField *surePswdTfl;

@end

@implementation LCResetPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (IBAction)backAction:(UIButton *)sender {
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (IBAction)confirmBtnAction:(UIButton *)sender {
    if (self.pswdTfl.text.length <= 0) {
        [self showErrorText:self.pswdTfl.placeholder];
    } else if (self.surePswdTfl.text.length <= 0) {
        [self showErrorText:self.surePswdTfl.placeholder];
    } else if (![self.surePswdTfl.text isEqualToString:self.pswdTfl.text]) {
        [self showErrorText:@"两次输入的密码不一致"];
    } else {
        [LCLoginService resetPswdWithMobStr:self.mobStr Usertokey:self.usertokey Pswd:self.pswdTfl.text SurePswd:self.surePswdTfl.text Block:^(BOOL isSuccess) {
            if (isSuccess) {
                [self showSuccessText:@"重置密码成功"];
                [self.navigationController popToRootViewControllerAnimated:YES];
            }
        }];
    }
}

@end
